package com.mycompany.app.hr.eleave.model;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;

import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;

import com.mycompany.app.util.DateUtil;

@Entity
@Table(name = "eleave_public_holiday")
public class PublicHoliday
//extends AuditBaseObject 
{

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Column(name = "holiday_id")
    private Long id;

    @Column(name = "public_holiday")
    private Date holidayDate;

    @Column(name = "public_holiday_desc")
    private String holidayDesc;

    // =======================================================
    @Override
    public String toString() {

        return ToStringBuilder.reflectionToString(this,
                ToStringStyle.SHORT_PREFIX_STYLE);
    }

    // =======================================================

    public String getFormatHoliday() {

        return (null == holidayDate) ? "" : DateUtil
                .convertDateToString(holidayDate);
    }

    // TODO
    public String getCanBeDelFlag() {

        // if (CalendarUtil
        // .compareDate(new java.util.Date(), this.getPublicHoliday())
        // != CalendarUtil.BEFORE) {
        // return "false";
        // }
        return "true";
    }

    /* ================================ */
    public Long getId() {

        return id;
    }

    public void setId(Long id) {

        this.id = id;
    }

    public Date getHolidayDate() {

        return holidayDate;
    }

    public void setHolidayDate(Date holidayDate) {

        this.holidayDate = holidayDate;
    }

    public String getHolidayDesc() {

        return holidayDesc;
    }

    public void setHolidayDesc(String holidayDesc) {

        this.holidayDesc = holidayDesc;
    }
}
